package com.yanqu.road.server.manger.activity.dafuweng.event;

import com.yanqu.road.entity.activity.dafuweng.DFWEvent;
import com.yanqu.road.server.manger.activity.dafuweng.DaFuWengMgr;
import com.yanqu.road.server.manger.activity.dafuweng.building.BaseDFWBuilding;
import com.yanqu.road.server.manger.activity.dafuweng.entiety.CollectEventResult;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

/**
 * @Author wpj
 * @Date 2021/1/7
 */
public class DFWCollectGoodsEvent extends BaseDFWEvent {


    public DFWCollectGoodsEvent(BaseDFWBuilding baseDFWBuilding, DFWEvent dfwEvent) {
        super(baseDFWBuilding, dfwEvent);
    }

    @Override
    public void doEvent() {
        Property property = PropertyHelper.parseStringToProperty(dfwEvent.getRewards());
        CollectEventResult eventResult = DaFuWengMgr.doCollectEvent(baseDFWBuilding.getUnionUid(), property, baseDFWBuilding.getPlayer().getUserId());
        unionCollectReachReward = eventResult.isUnionCollectReachReward();
        isCanDoCollectEvent = eventResult.isCanDoCollectEvent();
        reward = dfwEvent.getRewards();
        newBattleSkillId = eventResult.getNewBattleSkillId();
    }
}
